﻿@{
    ViewBag.Title = "Home Page";
}

@model IEnumerable<WebApplication3.EF.blog_Table>


       <script>
           function read(id) {
                $.ajax({
                    type: "get",
                    url: "/Home/Read?id="+id,
                    data: null,
                    dataType: null,
                    success: function () {                
                        window.location.href = "/Home/Read?id=" + id;
                    }
                });
            }
        </script>

<main>
    <!--banner begin-->
    @Html.Action("Slide")
    <!--banner end-->
    <div class="bloglist">
        <ul>
            @{ 
                int i = 0;
            }
            @foreach (var item in Model)
            {
                <li>
                    <i class="blogpic"><a asp-action="Read"><img src="@item.Image" alt=""> </a></i>
                    <dl>
                        <dt><a href="javascript:void(0)" onclick="read(@item.BlogID)">@item.Title</a></dt>
                        <dd>
                            <span class="bloginfo">@item.Synopsis</span>
                            <p class="timeinfo"><span class="lanmu"><a href="javascript:void(0)" target="_blank">个人博客</a></span><span class="date">@item.DateTime</span></p>
                            <a id="btn" class="read" href="javascript:void(0)" onclick="read(@item.BlogID)">阅读更多</a>
                        </dd>
                    </dl>
                </li>

                if (++i == 7)
                {
                    break;
                }

            }

        </ul>
    </div>
    <!--bloglist end-->
</main>
@Html.Action("Table")
